import instance from '../axios_config'

// 查询所有数据
const get_all_role = async (url: string) => {
  const data = await instance.get(url)
  return data.data
}

// 添加数据
const add_role = async (url: string, data: any) => {
  const Data = await instance.post(url, data)
  return Data.data
}

// 删除数据
const delete_role = async (id: string, url: string) => {
  const path = url + '/' + id
  const data = await instance.delete(path)
  return data
}

const edit_role = async (url: string, data: any) => {
  const path = url + data.id + '/'
  const Data = await instance.put(path, data)
  return Data.data
}
export default { get_all_role, add_role, delete_role, edit_role }
